package swing;

import jihe.DouDiZhu;

import javax.swing.*;
import java.awt.*;

public class Test02 extends JFrame {
    private DouDiZhu douDiZhu = new DouDiZhu();
    private ImageIcon gamerIcon1 = new ImageIcon("C:\\Users\\Administrator\\IdeaProjects\\LOVOlearn\\images\\a.jpg");
    private ImageIcon gamerIcon2 = new ImageIcon("C:\\Users\\Administrator\\IdeaProjects\\LOVOlearn\\images\\b.jpg");
    private ImageIcon gamerIcon3 = new ImageIcon("C:\\Users\\Administrator\\IdeaProjects\\LOVOlearn\\images\\c.jpg");
    //private ImageIcon pukeImage = new ImageIcon("images/3_1.jpg");
    //private ImageIcon pukeImage1 = new ImageIcon("images/3_2.jpg");

    public Test02(DouDiZhu douDiZhu){
        JLabel Label1 = new JLabel(gamerIcon1);
        Label1.setBounds(40,280,60,60);
        JLabel Label2 = new JLabel(gamerIcon2);
        Label2.setBounds(1090,280,60,60);
        JLabel Label3 = new JLabel(gamerIcon3);
        Label3.setBounds(570,670,60,60);
        JLabel jLabelText = new JLabel("地主牌");
        jLabelText.setBounds(560,50,120,30);
        jLabelText.setFont(new Font("宋体", Font.PLAIN,25));
        for (int i = 0; i < 17;i ++){
            int num = (douDiZhu.pukes.get(i).getPointValue()) / 10;
            int num2 = 5 -(douDiZhu.pukes.get(i).getPointValue()) % 10;

            JLabel jLabel = new JLabel(new ImageIcon("C:\\Users\\Administrator\\IdeaProjects\\LOVOlearn\\images\\" + num + "_" + num2 + ".jpg"));
            jLabel.setBounds(130,520-(i * 30),105,150);
            this.add(jLabel);
        }

        for (int i = 17; i < 34;i ++){
            int num = (douDiZhu.pukes.get(i).getPointValue()) / 10;
            int num2 = 5 - (douDiZhu.pukes.get(i).getPointValue()) % 10;
            JLabel jLabel = new JLabel(new ImageIcon("\\Users\\Administrator\\IdeaProjects\\LOVOlearn\\images\\" + num + "_" + num2 + ".jpg"));
            jLabel.setBounds(950,1030-(i * 30),105,150);
            this.add(jLabel);
        }

        for (int i = 34; i < 51;i ++){
            int num = (douDiZhu.pukes.get(i).getPointValue()) / 10;
            int num2 = 5 -(douDiZhu.pukes.get(i).getPointValue()) % 10;
            JLabel jLabel = new JLabel(new ImageIcon("\\Users\\Administrator\\IdeaProjects\\LOVOlearn\\images\\" + num + "_" + num2 + ".jpg"));
            jLabel.setBounds(780 - ((i-34) * 30),500,105,150);
            this.add(jLabel);
        }
        for (int i = 51; i < 54;i ++){
            int num = (douDiZhu.pukes.get(i).getPointValue()) / 10;
            int num2 = 5 -(douDiZhu.pukes.get(i).getPointValue()) % 10;
            JLabel jLabel = new JLabel(new ImageIcon("\\Users\\Administrator\\IdeaProjects\\LOVOlearn\\images\\" + num + "_" + num2 + ".jpg"));
            jLabel.setBounds(570 - ((i-51) * 30),100,105,150);
            this.add(jLabel);
        }
        this.setLayout(null);
        JButton button = new JButton("开始");
        button.setBounds(500,300,100,50);
       // JLabel pukeLabel = new JLabel(pukeImage);
       // pukeLabel.setBounds(0,0,105,150);
       // JLabel pukeLabel1 = new JLabel(pukeImage1);
       // pukeLabel1.setBounds(0,40,105,150);
       // JTextArea infoTextArea = new JTextArea();
        //infoTextArea.setBounds(100,300,100,200);
       // this.add(pukeLabel1);
        //this.add(pukeLabel);
        this.add(button);
       // this.add(infoTextArea);
        this.add(Label1);
        this.add(Label2);
        this.add(Label3);
        this.add(jLabelText);
        //设置标题栏文字
        this.setTitle("斗地主");
        //设置窗口大小
        this.setSize(1200,800);
        //设置窗口的关闭策略
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        //设置窗口默认打开的位置居中
        this.setLocationRelativeTo(null);
        //设置窗口显示状态
        this.setVisible(true);
    }
    public void paiXu(int start, int end){
        for (int i = start; i < end;i ++){
            int num = (douDiZhu.pukes.get(i).getPointValue()) / 10;
            int num2 = (douDiZhu.pukes.get(i).getPointValue()) % 10;
            JLabel jLabel = new JLabel(new ImageIcon("\\Users\\Administrator\\IdeaProjects\\LOVOlearn\\images\\" + num + "_" + num2 + ".jpg"));
            jLabel.setBounds(130,520-(i * 30),105,150);
            this.add(jLabel);
        }
    }

    public static void main(String[] args) {
        DouDiZhu douDiZhu = new DouDiZhu();
        douDiZhu.init();
        douDiZhu.shuffle();
        douDiZhu.sendCard();

        new Test02(douDiZhu);
    }
}
